check if binary tree is balanced